/*
 * 文 件 名:  CommonMap.java
 * 版   权: Copyright www.face-garden.com Corporation 2013 版权所有
 * 描     述:  <描述>
 * 修 改 人:  shiwei
 * 修改时间:  2013-11-11
 * 跟踪单号: <跟踪单号>
 * 修改单号: <修改单号>
 * 修改内容: <修改内容>
 */
package sample.utils;

import java.util.Map;

/**
 * <一句话功能简述>
 * <功能详细描述>
 * 
 * @author  shiwei
 * @version  [版本号, 2013-11-11]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public class CommonMap
{
    public static void setCommonMap(Map<String, Object> map)
    {
        map.put("basePath", "${basePath}");
        map.put("hiddeid", "${id}");
        map.put("rowId", "${row.id?c}");//@pageguide.p
        map.put("pageguide", "@pageguide.p");
        map.put("data", "<#if data??>");
        map.put("row", "<#list data as row>");
        map.put("list", "</#list> ");
        map.put("if", "</#if>");
        map.put("else", " <#else>");
        map.put("import", "<#import \"include/splitpage.ftl\" as pageguide>");
        map.put("index", "${(row_index+1)?c}");
        map.put("selectif", "<#if ");
        map.put("selecteq", "==");
        map.put("selectend", ">");

        map.put("jdbcdriverClassName", "${jdbc.driverClassName}");
        map.put("jdbcurl", "${jdbc.url}");
        map.put("jdbcusername", "${jdbc.username}");
        map.put("jdbcpassword", "${jdbc.password}");
        map.put("jdbcinitialSize", "${jdbc.initialSize}");
        map.put("jdbcmaxIdle", "${jdbc.maxIdle}");
        map.put("jdbcminIdle", "${jdbc.minIdle}");
        map.put("jdbcmaxActive", "${jdbc.maxActive}");
        map.put("jdbcmaxWait", "${jdbc.maxWait}");
        map.put("jdbcremoveAbandoned", "${jdbc.removeAbandoned}");
        map.put("jdbcremoveAbandonedTimeout", "${jdbc.removeAbandonedTimeout}");
        map.put("jdbclogAbandoned", "${jdbc.logAbandoned}");
        map.put("jdbctimeBetweenEvictionRunsMillis", "${jdbc.timeBetweenEvictionRunsMillis}");
        map.put("jdbcvalidationQuery", "${jdbc.validationQuery}");

        map.put("infodbthriftflag", "${info.db.thrift.flag}".replace("info.", map.get("projectName") + "."));
        map.put("infodbserverjsonserverPort",
                "${info.db.server.json.serverPort}".replace("info.", map.get("projectName") + "."));
        map.put("infodbserverjsonmaxWorkerThreads",
                "${info.db.server.json.maxWorkerThreads}".replace("info.", map.get("projectName") + "."));
        map.put("infodbserverjsonminWorkerThreads",
                "${info.db.server.json.minWorkerThreads}".replace("info.", map.get("projectName") + "."));
        map.put("infodbserverjsonasynServerPort",
                "${info.db.server.json.asynServerPort}".replace("info.", map.get("projectName") + "."));

        map.put("infoappthriftflag", "${info.app.thrift.flag}".replace("info.", map.get("projectName") + "."));
        map.put("infoappserverjsonserverPort",
                "${info.app.server.json.serverPort}".replace("info.", map.get("projectName") + "."));
        map.put("infoappserverjsonmaxWorkerThreads",
                "${info.app.server.json.maxWorkerThreads}".replace("info.", map.get("projectName") + "."));
        map.put("infoappserverjsonminWorkerThreads",
                "${info.app.server.json.minWorkerThreads}".replace("info.", map.get("projectName") + "."));
        map.put("infoappserverjsonasynServerPort",
                "${info.app.server.json.asynServerPort}".replace("info.", map.get("projectName") + "."));

        map.put("infoclientthriftflag", "${info.client.thrift.flag}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientserverIp", "${info.read.client.serverIp}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientserverPort",
                "${info.read.client.serverPort}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientconTimeOut",
                "${info.read.client.conTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientasyncServerIp",
                "${info.read.client.asyncServerIp}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientasyncServerPort",
                "${info.read.client.asyncServerPort}".replace("info.", map.get("projectName") + "."));
        map.put("inforead.client.asyncConTimeOut",
                "${info.read.client.asyncConTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientmaxActive",
                "${info.read.client.maxActive}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientmaxIdle", "${info.read.client.maxIdle}".replace("info.", map.get("projectName") + "."));
        map.put("inforeadclientasyncConTimeOut",
                "${info.read.client.asyncConTimeOut}".replace("info.", map.get("projectName") + "."));

        map.put("infowriteclientserverIp",
                "${info.write.client.serverIp}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientserverPort",
                "${info.write.client.serverPort}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientconTimeOut",
                "${info.write.client.conTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientasyncServerIp",
                "${info.write.client.asyncServerIp}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientasyncServerPort",
                "${info.write.client.asyncServerPort}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientasyncConTimeOut",
                "${info.write.client.asyncConTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientmaxActive",
                "${info.write.client.maxActive}".replace("info.", map.get("projectName") + "."));
        map.put("infowriteclientmaxIdle", "${info.write.client.maxIdle}".replace("info.", map.get("projectName") + "."));

        map.put("infoclientserverIp", "${info.client.serverIp}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientserverPort", "${info.client.serverPort}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientconTimeOut", "${info.client.conTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientasyncServerIp",
                "${info.client.asyncServerIp}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientasyncServerPort",
                "${info.client.asyncServerPort}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientasyncConTimeOut",
                "${info.client.asyncConTimeOut}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientmaxActive", "${info.client.maxActive}".replace("info.", map.get("projectName") + "."));
        map.put("infoclientmaxIdle", "${info.client.maxIdle}".replace("info.", map.get("projectName") + "."));

        map.put("cacheservers", "${cache.servers}");
        map.put("cacheweights", "${cache.weights}");
        map.put("cacheinitConn", "${cache.initConn}");
        map.put("cachemaxConn", "${cache.maxConn}");
        map.put("cacheminConn", "${cache.minConn}");
        map.put("cachemaxIdle", "${cache.maxIdle}");
        map.put("cachemaintSleep", "${cache.maintSleep}");
        map.put("cachenagle", "${cache.nagle}");
        map.put("cachesocketTO", "${cache.socketTO}");
        map.put("cachesocketConnectTO", "${cache.socketConnectTO}");

        map.put("solrsolrUrl", "${solr.solrUrl}");
        map.put("solrmaxTotalConnections", "${solr.maxTotalConnections}");
        map.put("solrsoTimeout", "${solr.soTimeout}");
        map.put("solrconnectionTimeout", "${solr.connectionTimeout}");
        map.put("solrdefaultMaxConnectionsPerHost", "${solr.defaultMaxConnectionsPerHost}");
        map.put("solrfollowRedirects", "${solr.followRedirects}");
        map.put("solrallowCompression", "${solr.allowCompression}");
        map.put("solrmaxRetries", "${solr.maxRetries}");

        map.put("mqurl", "${mq.url}");
        map.put("templatewebRoot", "${template.webRoot}");
        map.put("basechainname", "${base.chain.name}");
        map.put("basechainlist", "${base.chain.list}");
        map.put("thriftreconnectionexception", "${thrift.reconnection.exception}");

        map.put("projectname", "${project.name}");
        map.put("projectroot", "${project.root}");
        map.put("basedir", "${basedir}");
        map.put("srcdir", "${src.dir}");
        map.put("builddir", "${build.dir}");
        map.put("deployserverexplodeddir", "${deploy.server.exploded.dir}");
        map.put("deployjardir", "${deploy.jar.dir}");
        map.put("srcjavadir", "${src.java.dir}");
        map.put("projectlib", "${project.lib}");
        map.put("srcconfigdir", "${src.config.dir}");
        map.put("Mainclass", "${Main-class}");
        map.put("projectscript", "${project.script}");
        map.put("dbconfig", "${db.config}");

        map.put("tomcathome", "${tomcat.home}");
        map.put("tomcatwebapps", "${tomcat.webapps}");
        map.put("findbugshome", "${findbugs.home}");
        map.put("mailreceipts", "${mail.receipts}");
        map.put("runtimelib", "${runtime.lib}");
        map.put("deploywa.dir", "${deploy.war.dir}");
        map.put("tomcatwebapps", "${tomcat.webapps}");
        map.put("srcjspdir", "${src.jsp.dir}");
        map.put("_jar", "${_jar}");
        map.put("templatecssRoot", "${template.cssRoot}");
        map.put("templatejsRoot", "${template.jsRoot}");
        map.put("deploywardir", "${deploy.war.dir}");
        map.put("envTOMCAT_HOME", "${env.TOMCAT_HOME}");
        map.put("projectversion", "${project.version}");
        
        map.put("tree", "${tree}");
        map.put("parentid", "parentid");
        
        // 微信的处理
//        map.put("orderByClause", "${orderByClause}");
//        map.put("wechatId", "#{id,jdbcType=VARCHAR}");
//        map.put("wechat4", "#{");
//        map.put("wechat5", ",jdbcType=VARCHAR}");
//        map.put("criterioncondition", "${criterion.condition}");
//        map.put("criterionvalue", "#{criterion.value}");
//        map.put("criterionsecondValue", "#{criterion.secondValue}");
//        map.put("listItem", "#{listItem}");
    }
}
